package com.guangli.ocr.viewmodel

import android.app.Application
import androidx.databinding.ObservableField
import com.guangli.base.base.vm.RobotBaseViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction
import me.goldze.mvvmhabit.binding.command.BindingCommand
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent

class IdentificationCardViewModel(application: Application) : RobotBaseViewModel(application) {
    val name = ObservableField<String>()
    val gender = ObservableField<String>()
    val ethnic = ObservableField<String>()
    val birth = ObservableField<String>()
    val address = ObservableField<String>()
    val idNumber = ObservableField<String>()

    val issuingAuthority = ObservableField<String>()
    val signDate = ObservableField<String>()
    val expiryDate = ObservableField<String>()

    val isAndThe = ObservableField<Boolean>(true)

    val isAndTheLiveEvent = SingleLiveEvent<String>()
    val theOnclick = BindingCommand<Any>(BindingAction {
        isAndThe.set(false)
        isAndTheLiveEvent.postValue("1")
        name.set("")
        gender.set("")
        ethnic.set("")
        birth.set("")
        address.set("")
        idNumber.set("")
    })

    val isOnclick = BindingCommand<Any>(BindingAction {
        isAndThe.set(true)
        isAndTheLiveEvent.postValue("0")
        issuingAuthority.set("")
        signDate.set("")
        expiryDate.set("")
    })
}